package com.biz.hunter.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.biz.hunter.dao.PersonDAO;
import com.biz.hunter.db.entity.Person;
import com.biz.hunter.service.IPersonService;

@Service
public class PersonService implements IPersonService {
	@Autowired
	private PersonDAO personDAO;

	@Override
	public Person getPersonByID(Integer personId) {
		int id = personId.intValue();

		return personDAO.getById(id);
	}

	@Override
	public List<Person> getAllPersons() {
		return personDAO.getALL();
	}

	@Override
	public int createPerson(Person person) {
	 return personDAO.save(person);
	}

	@Override
	public void deleteById(Integer personId) {
        personDAO.delete(personId.toString());		
	}

	@Override
	public void updatePerson(Person person) {
		
		 personDAO.update(person);
		
	}

	
}
